﻿namespace Tszy.Unlimited.Base.Infrastructure.Logging;

/// <summary>
/// 
/// </summary>
public abstract class LoggerBase : ILogger
{
    /// <summary>
    /// 调试。
    /// </summary>
    /// <param name="message">日志信息。</param>
    /// <param name="exception">异常信息。</param>
    protected abstract void Debug(string message, Exception? exception = null);

    /// <summary>
    /// 错误。
    /// </summary>
    /// <param name="message">日志信息。</param>
    /// <param name="exception">异常信息。</param>
    protected abstract void Error(string message, Exception? exception = null);

    /// <summary>
    /// 致命。
    /// </summary>
    /// <param name="message">日志信息。</param>
    /// <param name="exception">异常信息。</param>
    protected abstract void Fatal(string message, Exception? exception = null);

    /// <summary>
    /// 信息。
    /// </summary>
    /// <param name="message">日志信息。</param>
    /// <param name="exception">异常信息。</param>
    protected abstract void Information(string message, Exception? exception = null);

    /// <summary>
    /// 警告。
    /// </summary>
    /// <param name="message">日志信息。</param>
    /// <param name="exception">异常信息。</param>
    protected abstract void Warning(string message, Exception? exception = null);

    void ILogger.Debug(string message, Exception? exception)
    {
        Debug(TszyLogger.Configs.GetMessage(message), exception);
    }

    void ILogger.Error(string message, Exception? exception)
    {
        Error(TszyLogger.Configs.GetMessage(message), exception);
    }

    void ILogger.Fatal(string message, Exception? exception)
    {
        Fatal(TszyLogger.Configs.GetMessage(message), exception);
    }

    void ILogger.Information(string message, Exception? exception)
    {
        Information(TszyLogger.Configs.GetMessage(message), exception);
    }

    void ILogger.Warning(string message, Exception? exception)
    {
        Warning(TszyLogger.Configs.GetMessage(message), exception);
    }
}